// =============================================================================
// XPathDebugger And Examples CashFlow.cs
// Copyright (c) 2013 TNTTechnologies Inc.
// =============================================================================

#region

using System;
using System.Collections.Generic;
using System.Xml.Serialization;

#endregion

namespace Example{
    [Serializable]
    public class CashFlow{
        [XmlAttribute("paymentDate")]
        public DateTime PaymentDate { get; set; }

        [XmlAttribute("tradeCurrencyType")]
        public int TradeCurrencyType { get; set; }

        [XmlAttribute("tradeName")]
        public string TradeName { get; set; }

        [XmlAttribute("tradeType")]
        public string TradeType { get; set; }

        [XmlAttribute("cashFlow")]
        public double CashFlowValue { get; set; }

        [XmlAttribute("PVCashFlow")]
        public double PVCashFlow { get; set; }

        [XmlAttribute("FXRate")]
        public double FXRate { get; set; }

        [XmlAttribute("cashFlowReportingCurrency")]
        public double CashFlowReportingCurrency { get; set; }

        [XmlAttribute("PVCashFlowReportingCurrency")]
        public double PVCashFlowReportingCurrency { get; set; }

        public static double SumCashFlowInReportingCurrency(List<CashFlow> listReportItems){
            double result = 0;

            for (int i = 0; i < listReportItems.Count; ++i){
                result += listReportItems[i].CashFlowReportingCurrency;
            }

            return result;
        }

        public static double SumPVCashFlowInReportingCurrency(List<CashFlow> listReportItems){
            double result = 0;

            for (int i = 0; i < listReportItems.Count; ++i){
                result += listReportItems[i].PVCashFlowReportingCurrency;
            }

            return result;
        }
    }
}